﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>layedit demo</title>
    <link href="Content/Layui-KnifeZ/css/layui.css" rel="stylesheet"/>
    <script src="Content/Layui-KnifeZ/layui.js"></script>
    <script src="Content/ace/ace.js"></script>
</head>
<body>
<div>
    <textarea id="layeditDemo"></textarea>
</div>
<script>
    layui.use(['layedit', 'layer', 'jquery'], function () {
        var $ = layui.jquery;
        var layedit = layui.layedit;
        layedit.set({
            //暴露layupload参数设置接口 --详细查看layupload参数说明
            uploadImage: {
                url: 'your url',
                accept: 'image',
                acceptMime: 'image/*',
                exts: 'jpg|png|gif|bmp|jpeg',
                size: 1024 * 10,
                done: function (data) {
                    console.log(data);
                }
            }
            , uploadVideo: {
                url: 'your url',
                accept: 'video',
                acceptMime: 'video/*',
                exts: 'mp4|flv|avi|rm|rmvb',
                size: 1024 * 10 * 2,
                done: function (data) {
                    console.log(data);
                }
            }
            //右键删除图片/视频时的回调参数，post到后台删除服务器文件等操作，
            //传递参数：
            //图片： imgpath --图片路径
            //视频： filepath --视频路径 imgpath --封面路径
            , calldel: {
                url: 'your url',
                done: function (data) {
                    console.log(data);
                }
            }
            //开发者模式 --默认为false
            , devmode: true
            //插入代码设置 --hide:true 等同于不配置codeConfig
            , codeConfig: {
                hide: false,  //是否显示编码语言选择框
                default: 'javascript' //hide为true时的默认语言格式
            }
            //新增iframe外置样式和js
            , quote:{
                style: ['/Content/Layui-KnifeZ/css/layui.css','/others'],
                js: ['/Content/Layui-KnifeZ/lay/modules/jquery.js']
            }
            , tool: [
                'html', 'code', 'strong', 'italic', 'underline', 'del', 'addhr', '|', 'fontFomatt', 'fontBackColor', 'colorpicker', 'face'
                , '|', 'left', 'center', 'right', '|', 'link', 'unlink', 'images', 'image_alt', 'video', 'anchors'
                , '|', 'fullScreen'
            ]
            , height: '90%'
        });
        var ieditor = layedit.build('layeditDemo');
    })
</script>
</body>
</html>